// 短信日志管理
<template>
  <div class="app-container">
  <el-card class="box-card" shadow="never" style="border:0px;">
      <div slot="header" style="color:#303133;font-size:14px;font-weight:bold;">
        <span>项目日志</span>
      </div>
    <!-- <div class="filter-container">
      <div class="left">
        <el-form :inline="true" class="demo-form-inline" size="medium" label-position="right">
          <el-form-item label="接收人：">
            <el-input v-model="listQuery.receiveName" clearable class="filter-item" placeholder="请输入接收人姓名" />
          </el-form-item>
          <el-form-item label="手机号：">
            <el-input v-model="listQuery.receivePhone" clearable class="filter-item" placeholder="请输入接收人手机号" />
          </el-form-item>
        </el-form>
      </div>
      <div class="right">
        <el-button type="primary" size="small" icon="el-icon-search" round @click="listProjectLog(listQuery)">查询</el-button>
        <el-button size="small" icon="el-icon-refresh" round @click="restForm">重置</el-button>
      </div>
    </div> -->

    <vxe-table
      v-loading="loading"
      :data="taskData"
      border="none"
      highlight-hover-row
      show-header-overflow
      show-overflow
      align="center"
      :header-cell-style="{ background: '#F7F7F8', color: '#606266' }"
      @cell-dblclick="cellDblclick"
    >
      <vxe-table-column type="seq" title="序号" width="70"/>
      <vxe-table-column title="数据id" field="id" />
      <vxe-table-column title="操作人" field="createName" />
      <vxe-table-column title="项目信息" field="projectJson" />
      <vxe-table-column title="借款人信息" field="borrowerJson" />
      <vxe-table-column title="抵押物信息" field="houseJson"/>
      <vxe-table-column title="操作状态" fixed="operateStates" >
        <template v-slot="{ row }">
          <span style="color:red" v-if="row.operateStates === '1'">删除</span>
          <span style="color:#E6A23C" v-if="row.operateStates === '2'">修改</span>
          <span style="color:#3c9ce6" v-if="row.operateStates === '3'">已恢复数据</span>
        </template>
      </vxe-table-column>
      <vxe-table-column title="操作时间" field="createTime"/>
      <vxe-table-column title="操作" fixed="right">
        <template v-slot="{ row }">
          <el-button v-if="row.operateStates==='1'" type="text" @click="restoreProject(row)">恢复</el-button>
          <el-button v-else type="text" @click="getById(row)">查看</el-button>
        </template>
      </vxe-table-column>
    </vxe-table>

  </el-card>  
    <vxe-pager
      class="pager"
      @page-change="changePage"
      :current-page.sync="listQuery.pageNo"
      :page-size.sync="listQuery.pageSize"
      :total="total"
      :page-sizes="[10, 30, 50, 100]"
      :layouts="['PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
    >
    </vxe-pager>
  </div>
</template>

<script>
import { listProjectLog,restoreProject} from '@/api/log';
export default {
  name: 'User',
  data: function () {
    return {
      active: 0,
      taskData: [],
      total: 0,
      loading: true,
      listQuery: {
        pageNo: 1,
        pageSize: 10
      },
    };
  },
  mounted: function () {
    this.listProjectLog();
  },
  // getTask
  methods: {
    // 列表查询
    listProjectLog() {
      this.loading = true;
      listProjectLog(this.listQuery).then((data) => {
        this.taskData = data.data;
        this.total = data.total;
        console.log('响应数据:%o', data);
        this.loading = false;
      });
    },

    restoreProject(data){
      this.loading = true;
      restoreProject(data).then((data) => {
        this.$message.success('操作成功');
        this.listProjectLog();
      });
      this.loading = false;
    },

    getById() {
      this.$message.error('该功能暂未实现哦');
    },
    changePage() {
      this.listProjectLog();
    },

    restForm() {
      this.listQuery = {
        pageNo: 1,
        pageSize: 10
      };
      this.listProjectLog();
    },
    cellDblclick({row,rowIndex,column,columnIndex,cell},event) {
      let _this = this;
      this.$copyText(event.target.innerText).then(function() {
        _this.$message.info('复制成功');
      });
    }
  },

};
</script>

<style lang="css" scoped>
.filter-container {
  display: flex;
  justify-content: space-between;
}

.pager{
  position: fixed;
  bottom: 0;
  right: 28px;
  background-color: #FAFAFB;
  z-index: 2;
  height: 40px;
  width: calc(100% - 260px);
  }

.right >>> .el-button--primary,.el-button--default {
  padding: 10px 20px;
}

.vxe-table--render-default >>> .el-button--text{
  color: #2b7bfb;
}
.app-container >>> .vxe-table--render-default,.vxe-pager {
  font-family: PingFangSC, Arial, Helvetica, sans-serif;
} 

.left {
  flex: 8;
  display: flex;
  flex-flow: row wrap;
  margin-right: 20px;
}
.left >>> .el-form {
  width: 100%;
}
.left >>> .el-form .el-form-item {
  display: flex;
  flex-flow: row nowrap;
  width: 30%;
  margin-right: 3%;
  float: left;
  margin-bottom: 14px;
}

.left >>> .el-form .el-form-item .el-form-item__label {
  font-weight: 500;
  color: #606266;
  text-align: left;
  /* flex: 1; */
}

.left >>> .el-form .el-form-item .el-form-item__content {
  flex: 1;
  /*超出部分隐藏*/
  text-overflow: ellipsis;
  /* 超出部分显示省略号 */
  white-space: nowrap;
  /*规定段落中的文本不进行换行 */
  width: 100%;
}
.date_item {
  width: 100%;
}
.right {
  flex: 2;
  display: flex;
  flex-flow: row nowrap;
  align-items: flex-end;
  margin-right: 30px;
  margin-bottom: 30px;
}
</style>
